import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 * This class is the controller for the store
 * @author Sravya
 *
 */
public class StoreController {

        private StoreView sv;
        private StoreModel sm;
        private MainPlayerController mp;
        private InventoryController ic;
//      private boolean hasUserPressedBuy;
        /**
         * This is the constructor for the StoreController and it initializes the parameters
         * @param ic
         * @param mp
         * @param sv
         * @param sm
         */
        public StoreController(InventoryController ic, MainPlayerController mp, StoreView sv, StoreModel sm)
        {
                this.sv = sv;
                this.mp = mp;
                this.sm = sm;
                this.ic = ic;
//              hasUserPressedBuy = false;
//              sv.addUserActionListener(new userActionListener());
        }
//      /**
//       * This method returns a boolean which tells whether or not a person has pressed the buy button
//       * @return
//       */
//      public boolean hasUserPressedBuy()
//      {
//              return hasUserPressedBuy;
//      }
//      /**
//       * This is the ActionLister for the user pressing the Buy button
//       * @author Sravya
//       *
//       */
//      private class userActionListener implements ActionListener
//      {       
//              public void actionPerformed(ActionEvent e) 
//              {
//                      int i = 0;
//                      while(i < sv.getTextFields().length && !e.getSource().equals(sv.getTextFields()[i]))    
//                              i++;
//                      
//                      if(i < sv.getTextFields().length)
//                      {
//                              int quantity = Integer.parseInt(sv.getTextFields()[i].getText());
//                              mp.addCash(-(sm.getPrice(i) * quantity));
//                              
//                              ic.incrementQuantityOfItem(sm.getType(i), quantity);
//                              sv.setLabel(i, "" + ic.getQuantityOfItem(sm.getType(i)));
//                      }
//                      else
//                              hasUserPressedBuy = true;
//              }
//
//      }
        
}

